package com.zhht.checkcop.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhbc.framework.dao.IBaseDao;
import com.zhbc.framework.service.ABaseServiceImpl;
import com.zhht.checkcop.check.vo.MovieVO;
import com.zhht.checkcop.dao.MovieDao;
import com.zhht.checkcop.service.MovieService;

@Transactional
@Service("movieService")
public class MovieServiceImpl extends ABaseServiceImpl<MovieVO> implements MovieService{
	@Autowired
	private MovieDao movieDao;
	
	
	protected IBaseDao<MovieVO> getBaseDao() {
		return movieDao;
	}

	public List<MovieVO> getListByName(String MovieName,int pageNum, int pageSize) throws Exception {
		List<MovieVO> list = movieDao.getListByName(MovieName);
		return list;
	}

	public PageInfo<MovieVO> getListByClassify(String classifyId,String sort,int pageNum, int pageSize) throws Exception {
		PageHelper.startPage(pageNum, pageSize);
		Map<String,Object> selectMap=new HashMap<String,Object>();
		selectMap.put("classifyId", classifyId);
		List<MovieVO> list = movieDao.selectList(selectMap);
		return new PageInfo<MovieVO>(list);
	}

	public MovieVO getMovieVOById(String MovieId) throws Exception {
		return movieDao.selectByPrimaryKey(MovieId);
	}
	
	public List<String> getMoviePicUrl(String movieId) throws Exception {
		return movieDao.getMoviePicUrl(movieId);
	}
	
}
